package net.zjitc.service.impl;


import net.zjitc.dao.UserDao;
import net.zjitc.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

//@Component("userService")
@Service("userService")

public class UserServiceImpl implements UserService {
    @Value("itacst")
    private String driver;
    @Resource(name="userDao")
//    @Autowired//按照数据类型从Spring容器中进行匹配
//    @Qualifier("userDao")//按照id值从容器进行匹配，但是要与@Autowired结合使用
    private UserDao userDao;
//
//    public UserServiceImpl(UserDao userDao) {
//        this.userDao = userDao;
//    }
//
//    public UserServiceImpl() {
//    }
//        public void setUserDao(UserDao userDao) {
//        this.userDao = userDao;
//    }

    public void save(){
        System.out.println(driver);
        userDao.save();
    }
}
